<template>
	<view class="goods-item"
		v-if="item.goods_id"
		@tap="handleToPro(item.goods_id)">
		<view class="left">
			<image :src="item.goods_image" mode="widthFix"></image>
		</view>
		<view class="right">
			<view class="tit text-ellipsis-2">{{ item.goods_name }}</view>
			<view class="count">已售 {{ item.goods_sales }} 件</view>
			<view class="price">
				<text class="new">¥ {{ item.goods_price_max }}</text>
				<text class="old">¥ {{ item.goods_price_min }}</text>
			</view>
		</view>
	</view>
</template>

<script>

	export default {
		name: "GoodsItem",
		data () {
			return {}
		},
		props: {
			item: {
				type: Object,
				default: () => {
					return {}
				}
			}
		},
		methods: {
			handleToPro (id) {
				uni.navigateTo({
					url: '/subpkg/prodetail/index?id=' + id
				})
			}
		}
	}
</script>

<style lang="less">
.goods-item {
	display: flex;
	height: 296rpx;
	margin-bottom: 12rpx;
	padding: 20rpx;
	background-color: #fff;
	.left {
		width: 254rpx;
		image {
			display: block;
			width: 254rpx;
		}
	}
	.right {
		display: flex;
		flex-direction: column;
		justify-content: space-evenly;
		flex: 1;
		font-size: 28rpx;
		line-height: 1.3;
		padding: 20rpx;
		.count {
			color: #999;
			font-size: 24rpx;
		}
		.price {
			color: #999;
			font-size: 32rpx;
			.new {
				color: #f03c3c;
				margin-right: 20rpx;
			}
			.old {
				text-decoration: line-through;
				font-size: 24rpx;
			}
		}
	}
}
</style>
